package com.sx.product.controller;


import com.sx.product.service.ProductService;
import common.pojo.Products;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/product")//服务提供者
public class ProductController {


    @Autowired
    private ProductService productService;

    @RequestMapping("/findById/{id}")
    public @ResponseBody Products findById(@PathVariable long id)
    {
    	return productService.findById(id);
    }
    
    @RequestMapping("/findAll")
    public @ResponseBody List<Products> findAll() {
        return productService.findAll();
    }

}
